import {createBrowserRouter} from 'react-router-dom'
import App from '../App'


// type routesType={
//     path:string;
//     element:JSX.Element;
//     children?:{path:string;element:JSX.Element}[]
// }[]

// const routes:routesType=createBrowserRouter([
const routes=createBrowserRouter([
    {
        path:'/',
        element:<App/>,
        children:[
            {
                path:'index',
                lazy:async()=>{
                    const{ default:Index}=await import('../pages/index/Index')
                    return{
                        element:<Index/>
                    }
                }
            },
            {
                path:'order',
                lazy:async()=>{
                    const{ default:Order}=await import('../pages/order/Index')
                    return{
                        element:<Order/>
                    }
                }
            }
        ]
    },
    {
        path:'login',
        lazy:async()=>{
            const{ default:Login}=await import('../pages/login/Index')
            return{
                element:<Login/>
            }
        }
    }
])
export default routes